package com.efounder.frame.activity;//package com.efounder.frame.activity;
//
//import android.graphics.drawable.Drawable;
//import android.os.Bundle;
//import android.support.v4.app.Fragment;
//import android.support.v4.app.FragmentManager;
//import android.support.v4.widget.DrawerLayout;
//import android.util.TypedValue;
//import android.view.Gravity;
//import android.view.View;
//import android.widget.ImageView;
//
//import com.core.xml.StubObject;
//import com.efounder.frame.activity.helper.EFAppAccountActivityHelper;
//import com.efounder.frame.baseui.EFActivity;
//import com.efounder.frame.title.EFSlidingTabStripTitleView;
//import com.efounder.frame.utils.EFConstants;
//import com.efounder.frame.widget.EFSlidingTabStrip;
//import com.efounder.frame.xmlparse.EFXmlConstants;
//import com.efounder.frame.xmlparse.EFXmlParser;
//import com.efounder.mobilemanager.R;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by hudq on 2016/8/29.
// * 应用号Activity
// */
//
//public class EFAppAccountActivity_old extends EFActivity {
//    private EFAppAccountActivityHelper helper;
//
//    private Map<String, List<StubObject>> dataMap;
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.ef_activity_app_accounts);
//        //初始化xml中数据
//        dataMap = initXmlData();
//        //初始化titleView
//        EFSlidingTabStrip slidingTabStrip = initTitleView(savedInstanceState);
//        helper = new EFAppAccountActivityHelper(this,slidingTabStrip,dataMap);
//        if (savedInstanceState != null){//恢复currentPosition
//            int currentPosition = savedInstanceState.getInt("currentPosition");
//            helper.setCurrentPosition(currentPosition);
//        }
//        List<StubObject> oneLevelStubList = dataMap.get(EFXmlConstants.ELE_MENU_ROOT);
//        helper.createSlidingTabStrip(oneLevelStubList,savedInstanceState);
//
//    }
//
//    private Map<String, List<StubObject>> initXmlData() {
//        Map<String, List<StubObject>> dataMap = EFXmlParser.getInstance().parseXml(EFConstants.APPS_DIR + "/App1/app_frame.xml" );
//        return  dataMap;
//    }
//
//    private EFSlidingTabStrip initTitleView(Bundle savedInstanceState){
//        EFSlidingTabStripTitleView titleView = new EFSlidingTabStripTitleView(this);
//        replaceEFTitleView(titleView);
//        //左
//        ImageView leftImageView = titleView.getLeftImageView();
//        int leftImageViewPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,7,getResources().getDisplayMetrics());
//        leftImageView.setPadding(leftImageViewPadding,leftImageViewPadding,leftImageViewPadding,leftImageViewPadding);
//        leftImageView.setImageDrawable(Drawable.createFromPath(EFConstants.APPS_DIR + "/App1/image/icon"));
//        //设置允许打开左边抽屉
//        initDrawerLayout(savedInstanceState);
//        leftImageView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                getDrawerLayout().openDrawer(Gravity.LEFT);
//            }
//        });
//        //右
//        final ImageView rightImageView = titleView.getRightImageView();
//        rightImageView.setPadding(leftImageViewPadding,leftImageViewPadding,leftImageViewPadding,leftImageViewPadding);
//        rightImageView.setImageResource(R.drawable.ef_title_view_more_normal);
//        rightImageView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                List<StubObject> menuStubList = dataMap.get(EFXmlConstants.ELE_POPUP_MENU);
//                helper.createPopupMenu(rightImageView,menuStubList);
//            }
//        });
//
//        //中间
//        EFSlidingTabStrip slidingTabStrip = (EFSlidingTabStrip) titleView.getCenterView();
//
//        return  slidingTabStrip;
//
//    }
//
//    /**
//     * 初始化DrawerLayout
//     */
//    private void initDrawerLayout(Bundle savedInstanceState){
//        //设置允许打开左边抽屉
//        getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.LEFT);
//        if (savedInstanceState == null){
//            //TODO 设置左边抽屉Fragment
//            try {
//                FragmentManager fragmentManager = getSupportFragmentManager();
//                Fragment leftFragment = (Fragment) Class.forName("com.efounder.fragment.AppAccountLeftDrawerFragment").newInstance();
//                fragmentManager.beginTransaction().replace(getDrawerLayoutLeftLayoutResId(),leftFragment).commit();
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//        }
//    }
//
//    @Override
//    public void onSaveInstanceState(Bundle outState) {
//        super.onSaveInstanceState(outState);
//        outState.putInt("currentPosition",helper.getCurrentPosition());
//    }
//}
